package com.knowif.backend.controller;

import com.knowif.backend.dto.OfferDto;
import com.knowif.backend.service.OfferInterviewThanksCollectionService;
import com.knowif.backend.service.OfferService;
import com.knowif.backend.service.SchoolService;
import com.knowif.backend.service.StanderSorceService;
import com.knowif.pojo.Offer;
import com.knowif.pojo.OfferInterviewThanksCollection;
import com.knowif.pojo.School;
import com.knowif.pojo.SchoolExample;
import com.knowif.search.SearchCondition;
import com.knowif.system.model.RestBean;
import com.knowif.util.ExampleUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

/**
 * @author ：Xh
 * @date ：Created in 2019/6/10 0010 20:50
 */
@RestController
@RequestMapping("/wechat")
public class ThanksCollectionsController {

    @Autowired
    private OfferInterviewThanksCollectionService thanksCollectionService;

    @PostMapping("/thank/collection/save")
    public RestBean<?> save(@RequestBody OfferInterviewThanksCollection offerInterviewThanksCollection){
        offerInterviewThanksCollection.setCreateTime(new Date());
        thanksCollectionService.saveOfferInterviewThanksCollection(offerInterviewThanksCollection);
        return RestBean.build(200);
    }

    /**
     * 取消感谢or收藏
     * @param offerInterviewThanksCollection
     * @return
     */
    @PostMapping("/thank/collection/cancle")
    public RestBean<?> cancle(@RequestBody OfferInterviewThanksCollection offerInterviewThanksCollection){
        thanksCollectionService.cancle(offerInterviewThanksCollection);
        return RestBean.build(200);
    }

}
